﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class HumanClass
{
    static void Main(string[] args)
    {
        Student[] students =
        {
            new Student ("Ivancho","Kostov",12),
            new Student ("Pesho","Peshov",11),
            new Student ("Krasi","Kostov",12),
            new Student ("Pesho","Peshov",10),
            new Student ("Todor","Kostov",4),
            new Student ("Vlado","Peshov",6),
            new Student ("Kiro","Kostov",12),
            new Student ("Krasimira","Peshova",3),
            new Student ("Simona","Kostova",4),
            new Student ("Ceco","Peshov",5)
        };
        for (int i = 0; i < 10; i++)
        {
            Console.WriteLine(students[i].FirstName + " " + students[i].LastName + " " + students[i].Grade);
        }
        Console.WriteLine("************************");
        for (int i = 0; i < 9; i++)
        {
            for (int j = i; j < 10; j++)
            {
                if (students[i].Grade > students[j].Grade)
                {
                    Student a;
                    a = students[i];
                    students[i] = students[j];
                    students[j] = a;
                }
            }
        }
        for (int i = 0; i < 10; i++)
        {
            Console.WriteLine(students[i].FirstName + " " + students[i].LastName + " " + students[i].Grade);
        }

        Worker[] workers = 
        {
            new Worker ("Ivancho","Kostov",40.20,3),
            new Worker ("Pesho","Peshov",30.20,11),
            new Worker ("Krasi","Kostov",24.11,12),
            new Worker ("Pesho","Peshov",50.34,10),
            new Worker ("Todor","Kostov",60,4),
            new Worker ("Vlado","Peshov",10,6),
            new Worker ("Kiro","Kostov",540,12),
            new Worker ("Krasimira","Peshova",90,3),
            new Worker ("Simona","Kostova",43,4),
            new Worker ("Ceco","Peshov",53,5)
        };
        for (int i = 0; i < 10; i++)
        {
            Console.WriteLine(workers[i].FirstName + " " + workers[i].LastName + " " + workers[i].MoneyPerHour());
        }
        Console.WriteLine("************************");
        for (int i = 0; i < 9; i++)
        {
            for (int j = i; j < 10; j++)
            {
                if (workers[i].MoneyPerHour() < workers[j].MoneyPerHour())
                {
                    Worker worker;
                    worker = workers[i];
                    workers[i] = workers[j];
                    workers[j] = worker;
                }
            }
        }
        for (int i = 0; i < 10; i++)
        {
            Console.WriteLine(workers[i].FirstName + " " + workers[i].LastName + " " + workers[i].MoneyPerHour());
        }

    }
}
class Human
{
    private string firstName;
    private string lastName;
    public Human(string fName, string lName)
    {
        firstName = fName;
        lastName = lName;
    }
    public string FirstName
    {
        get { return firstName; }
        set { firstName = value; }
    }
    public string LastName
    {
        get { return lastName; }
        set { lastName = value; }
    }
}
class Student : Human
{
    private int grade;
    public Student(string fName, string lName, int gr)
        : base(fName, lName)
    {
        grade = gr;
    }
    public int Grade
    {
        get { return grade; }
        set { grade = value; }
    }
}
class Worker : Human
{
    private double weekSalary;
    private int hoursPerDay;
    public Worker(string fName, string lName, double wSalary, int hPerDay)
        : base(fName, lName)
    {
        weekSalary = wSalary;
        hoursPerDay = hPerDay;

    }
    public double WeekSalary
    {
        get { return weekSalary; }
        set { weekSalary = value; }
    }
    public int HoursPerDay
    {
        get { return hoursPerDay; }
        set { hoursPerDay = value; }
    }
    public double MoneyPerHour()
    {
        return (weekSalary / (7 * hoursPerDay));
    }
}


